import { createApp } from 'vue'
import zhCn from 'element-plus/dist/locale/zh-cn'
import 'element-plus/dist/index.css'
// import '@/assets/theme/theme.scss'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import App from './App.vue'

import '@/assets/css/style.css'
import '@/assets/css/element.css'

const debounce = (fn, delay) => {
  let timer = null
  return function () {
      let context = this
      let args = arguments
      clearTimeout(timer)
      timer = setTimeout(function () {
          fn.apply(context, args)
      }, delay)
  }
}

const _ResizeObserver = window.ResizeObserver
window.ResizeObserver = class ResizeObserver extends _ResizeObserver{
    constructor(callback) {
        callback = debounce(callback, 16)
        super(callback)
    }
}

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(ElementPlus, {
    locale: zhCn,
})
app.mount('#app')
